package com.jams.goodox.activity.serve;

import android.app.Activity;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.listen.ActionResultListener;
import com.jams.goodox.net.BaseEntity;
import com.jams.goodox.net.RetrofitCallbackListener;
import com.jams.goodox.net.services.RentingService;

import retrofit2.Call;

/**
 * Created by jams on 2017/5/5.
 * ***
 * Tel: ***
 */

public class PriseCommentUtils {
    //评论
    public static void comment(final Activity activity, String id, String msgId, String msgContent, String toUserId, String type, final ActionResultListener praiseListener) {
        if(activity instanceof BaseActivity){
            ((BaseActivity) activity).enqueue(((BaseActivity) activity).createCallService(RentingService.class).comment(type, id, msgId, msgContent, toUserId, null),
                    new RetrofitCallbackListener<BaseEntity>() {
                        @Override
                        public void onSuccess(Call<BaseEntity> call, BaseEntity result) {
                            praiseListener.success();
                        }

                        @Override
                        public void onError(String msg) {
                            praiseListener.failure();
                        }
                    });
        }

    }
}
